package ACwing.P4Math.CommonDivisor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * @Date : 2023-03-16
 * @Description: 869. 试除法求约数
 * 求一个数的所有约数
 */
public class CommonDivisor {
    static List<Integer> res=new ArrayList<>();
    static int n;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n--!=0){
            int x = scanner.nextInt();
            get_divisors(x);
        }
    }
    static void get_divisors(int x){
        List<Integer> list=new ArrayList<>();
        for (int i = 1; i <= x/i; i++) {
            if(x%i==0){
                list.add(i);
                if(i!=x/i) list.add(x/i); //每次加入两个，除了边界
            }
        }
        Collections.sort(list);
        for(Integer t:list) System.out.print(t+" ");
        System.out.println();
    }
}

